home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / wnos / wn941101 / proc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-10  |  2.3 KB  |  78 lines

  1. #ifndef    _PROC_H
  2. #define    _PROC_H
  3.  
  4. #include <setjmp.h>
  5.  
  6. #ifndef _MBUF_H
  7. #include "mbuf.h"
  8. #endif
  9.  
  10. #ifndef    _TIMER_H
  11. #include "timer.h"
  12. #endif
  13.  
  14. #define    PHASH    16                /* Number of wait table hash chains */
  15.  
  16. /* Kernel process control block */
  17. struct proc {
  18.     struct proc *prev;            /* Process table pointers */
  19.     struct proc *next;
  20.  
  21.     jmp_buf env;                /* Process state */
  22.     int i_state;                /* Process interrupt state */
  23.  
  24.     unsigned short state;
  25. #define    READY    0
  26. #define    WAITING    1
  27. #define    SUSPEND    2
  28.  
  29.     void *event;                /* Wait event */
  30.     int16 *stack;                /* Process stack */
  31.     unsigned int stksize;        /* Size of same */
  32.     char name[30];                /* Arbitrary user-assigned name */
  33.     void *retval;                /* Return value from next pwait() */
  34.     struct timer alarm;            /* Alarm clock timer */
  35.     int input;                    /* standard input socket */
  36.     int output;                    /* standard output socket */
  37.     int iarg;                    /* Copy of iarg */
  38.     void *parg1;                /* Copy of parg1 */
  39.     void *parg2;                /* Copy of parg2 */
  40.     int freeargs;                /* Free args on termination if set */
  41. };
  42. #define NULLPROC (struct proc *)0
  43.  
  44. extern int Stkchk;                /* Stack checking flag */
  45.  
  46. extern struct proc *Curproc;    /* Currently running process */
  47. extern struct proc *Rdytab;        /* Head of ready list */
  48. extern struct proc *Waittab;    /* Head of wait list */
  49. extern struct proc *Susptab;    /* Suspended processes */
  50.  
  51. /* In  kernel.c: */
  52. void alert __ARGS((struct proc *pp,void *val));
  53. void chname __ARGS((struct proc *pp,char *newname));
  54. void killproc __ARGS((struct proc *pp));
  55. void killself __ARGS((void));
  56. struct proc *mainproc __ARGS((char *name));
  57. struct proc *newproc __ARGS((char *name,unsigned int stksize,
  58.     void (*pc) __ARGS((int,void *,void *)),
  59.     int iarg,void *parg1,void *parg2,int freeargs));
  60. int psignal __ARGS((void *event,int n));
  61. void *pwait __ARGS((void *event));
  62. void resume __ARGS((struct proc *pp));
  63. void semwait __ARGS((int *sema,int req));
  64. void semrel  __ARGS((int *sema));
  65. void suspend __ARGS((struct proc *pp));
  66.  
  67. /* In ksubr.c: */
  68. void chkstk __ARGS((void));
  69. void kinit __ARGS((void));
  70. unsigned phash __ARGS((void *event));
  71. void psetup __ARGS((struct proc *pp,int iarg,void *parg1,void *parg2,
  72.     void  __ARGS(((*pc) __ARGS((int,void *,void *)) )) ));
  73.  
  74. /* Stack background fill value for high water mark checking */
  75. #define    STACKPAT    0x55aa
  76.  
  77. #endif    /* _PROC_H */
  78.